<?php
/**
 *	@name		担保交易
 *	@author		Jeffery
 *	@qq			1017756891
 *	@email		1017756891@qq.com
 *	@website	http://www.iweitao.net
**/

if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
	exit('Access Denied');
}
include "safe.class.php";
$safe = new safe_weitao_plugin_online_alipay();
$thread_guarantee =  DB::table("thread_guarantee");
if($safe->getparameter('mod',1,0)) {
	$mod = $safe->getparameter('mod',1,0);
	$tid = $safe->getparameter('tid',1,1);
	if($mod == 'success') {
		DB::query("UPDATE `$thread_guarantee` SET `status` = '2' WHERE `tid` = '$tid'");
		cpmsg("订单状态更新成功!",'','succeed');
	} else if($mod == 'error') {
		DB::query("UPDATE `$thread_guarantee` SET `status` = '5' WHERE `tid` = '$tid'");
		cpmsg("订单状态更新成功!",'','succeed');
	}
}
$query = DB::query("SELECT * FROM `$thread_guarantee` WHERE `status` = '1'");
while($list = mysql_fetch_array($query)) {
	$orderlist[$list[0]] = array(
		'sellername' => $list['sellername'],
		'buyername' => $list['buyername'],
		'price' => $list['price'],
		'qq' => $list['qq'],
		'myprice' => $list['myprice'],
		'phone' => $list['phone'],
	);
}

showtableheader('帖子操作', 'nobottom');
echo "<tr><td>交易编号</td><td>卖家姓名</td><td>买家姓名</td><td>买家应付</td><td>QQ</td><td>交易收入</td><td>电话</td><td>银行类型</td><td>银行账户</td><td>操作</td></tr>";
foreach($orderlist as $k => $v) {
	echo "<tr>";
	echo "<td>$k</td>";
	echo "<td>".$v['sellername']."</td>";
	echo "<td>".$v['buyername']."</td>";
	echo "<td>".$v['price']."</td>";
	echo "<td>".$v['qq']."</td>";
	echo "<td>".$v['myprice']."</td>";
	echo "<td>".$v['phone']."</td>";
	echo "<td>".$v['account_type']."</td>";
	echo "<td>".$v['account_hao']."</td>";
	echo "<td>
			<a href='admin.php?action=plugins&operation=config&do=63&identifier=online_alipay&pmod=admincp&mod=success&tid=$k'>审核通过</a>
			<a href='admin.php?action=plugins&operation=config&do=63&identifier=online_alipay&pmod=admincp&mod=error&tid=$k'>拒绝通过</a>
		</td>";
	echo"</tr>";
}
showtablefooter();
?>